
{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <section class="col-lg-12 connectedSortable">
         <div class="box box-default box-solid">
             <form action="" method="post" enctype="multipart/form-data">
                <div class="box-header with-border">
                    <span class="fa fa-pencil" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">添加文章</p>
					
                </div>
				
                <div class="box-body">
                   <div class=" form-group" style="padding:0;">
						  <label for="inputPassword3" class="col-sm-1 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
							   年级：
						  </label>
						  <div class="input-group col-md-5 col-xs-12">

							   <select class="form-control" name="grade_id" id="grade_id">   
							    {%foreach from=$grade_lists key=key item=value%} 
								  <option value="{%$value.grade_id%}"{%if $value.grade_id==$manage_data.grade_id%}selected{%/if%}>{%$value.grade_name%}</option>
                                {%/foreach%}  
                               </select> 
						 </div> 
				</div>
				<div class=" form-group" style="padding:0;">
						  <label for="inputPassword3" class="col-sm-1 control-label text-right" style="padding-right:0; padding-left:0; font-weight:500; margin:0;">
							   班级：
						  </label>
						  <div class="input-group col-md-5 col-xs-12">

							   <select class="form-control" name="class_id" id="class_id"> 
									{%foreach from=$class_lists key=key item=value%} 
									  <option value="{%$value.class_id%}"{%if $value.class_id == $manage_data.class_id%}selected{%/if%}>{%$value.class_name%}</option>
									{%/foreach%}  
                               </select> 
						  </div> 
				</div>
                    <div class="form-group">
						  <label for="inputPassword3" class="col-md-1 control-label" style="padding-right:0; padding-left:0; font-weight:500;">
							   文章标题：
						  </label>
						  <div class="input-group col-md-5 col-sm-12 col-xs-12">
							   <input type="text" class="form-control" value="{%$manage_data.manage_title%}" name="manage_title"> 
						  </div> 
				    </div>
                    <div class="form-group">
						 <label for="inputPassword3" class="col-md-1 control-label" style="padding-right:0; padding-left:0; font-weight:500;">
							   文章内容：
						  </label>
                          <div class="input-group col-md-11 col-sm-12 col-xs-12">
						     <textarea id="category_content" name="manage_content" rows="12" style="width: 100%">{%$manage_data.manage_content%}</textarea>
						 </div>
					</div>
					 <div class="form-group">
						  <label for="inputPassword3" class="col-md-1 control-label" style="padding-right:0; padding-left:0; font-weight:500;">
							   附件：
						  </label>
						  <div class="input-group col-md-6 col-sm-12 col-xs-12">
							    {%if $manage_data.manage_file!=""%}
								<br><input type="radio" name="manage_file_re" value="0" checked>
								<a href="upload/manage_file/{%$manage_data.manage_file%}" target="_blank">{%$manage_data.manage_file%}</a>
								<br><br><input type="radio" name="manage_file_re" value="1" > 重新上传 <input id="manage_file" name="manage_file" type="file" size="60"/>
								{%else%}
								<input id="manage_file" name="manage_file" type="file" size="60"/>
								<input type="hidden" name="manage_file_re" value="1">
								{%/if%}

						  </div> 
				    </div>
				   </div><!--box-body -->
                <div class="box-footer text-center">
					<input type="hidden" name="a" value="manage.listjson">
                    <button type="submit" class="btn btn-primary ">  保 存</button>
                </div>
             </form>
           </div><!--box box-default box-solid-->
        </section>   
           
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
{%include file="index.footer.tpl.php"%}
 <!--二级联动-->
  <script type="text/javascript">
        $(document).ready(function () {

            $("#grade_id").change(function () {		

                if ($(this).val() == "-1") {
					$("#industr").remove(); return; 
					}
                else {
			var timestamp = new Date().getTime();
			$.ajax({
			url:"http://schoolplat.wangyunw.com/public/index.php?a=manage.listjsonee",
			type:"get",
			data: "grade_id=" + $("#grade_id").find("option:selected").val() + "&timestamp=" + timestamp,
			dataType:"json",
			success:function(msg){
			   
                            //实例2个字符串变量来拼接下拉列表
                            var industr = "";
                            //使用jquery解析json中的数据
                            $.each(msg, function (n, value) {
                                industr += ("<option value=\"" + value.class_id + "\">" + value.class_name);
                                industr += ("</option>");
                            });

                            $("#class_id").html(industr);			   			   
			}
			});					

                }

            });

        });
</script>
<!--日期-->
<script>
 $(function() {
    $( "#datepicker" ).datetimepicker({
	  timeFormat: "HH:mm",
      showOtherMonths: true,
      selectOtherMonths: true,
	  changeMonth: true,
      changeYear: true,   
    });
 })
</script>
<script type="text/javascript" src="static/xhe/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="static/xhe/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
	$.extend(XHEDITOR.settings,{shortcuts:{'ctrl+enter':submitForm}});//修改默认设置
	$('#category_content').xheditor({modalWidth:700,modalHeight:500,upBtnText:'浏览',upLinkUrl:"!ckfinder/upload.html",upImgUrl:"!ckfinder/upload.html?type=Images",upFlashUrl:"!ckfinder/upload.html?type=Flash",upMediaUrl:"!ckfinder/upload.html"});
}
function submitForm(){$('#myform').submit();}
</script>

